<template>
	<view>
		<uni-popup ref="popup" :mask-click="false" :safe-area="false">
			<view class="modal_box">
				<view class="title" v-if="showTitle">
					驳回原因
				</view>
				<view class="body flex_c">
					<view>{{content||''}}</view>
				</view>
				<view class="footer flex_sb">
					<view class="btn gray" @click="close" v-if="showCancel">
						取消
					</view>
					<view class="btn" @click="confirm">
						{{confirmText}}
					</view>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		props: {
			content: {
				type: String,
				default: '是否确认提交?'
			},
			showCancel: {
				type: Boolean,
				default: true
			},
			showTitle: {
				type: Boolean,
				default: false
			},
			confirmText:{
				type: String,
				default: '我知道了'
			}
		},
		name: "modal",
		data() {
			return {
				modalShow: false,
			};
		},
		methods: {
			// 在线支付二次弹窗
			open() {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
				this.$refs.popup.open()
			},
			close() {
				// 通过组件定义的ref调用uni-popup方法 ,如果传入参数 ，type 属性将失效 ，仅支持 ['top','left','bottom','right','center']
				this.$refs.popup.close()
			},
			confirm() {
				this.modalShow = false
				this.$emit('confirm')
			}
		}

	}
</script>

<style lang="scss" scoped>
	.modal_box {
		width: 540rpx;
		// height: 482rpx;
		border-radius: 33rpx;
		background: #FFFFFF;
		overflow: hidden;
		font-size: 28rpx;
		font-weight: 500;
		color: #3D3D3D;
		text-align: center;
		padding-top: 47rpx;
		.title {
			font-size: 32rpx;
		}

		.body {
			font-size: 32rpx;
			font-weight: 550rpx;
			padding: 15rpx 46rpx 37rpx;
			line-height: 50rpx;
		}

		.footer {
			width: 100%;
			height: 100rpx;
			line-height: 100rpx;
			border-top: 2rpx solid #F2F2F2;

			.btn {
				height: 100%;
				// width: 50%;
				flex-grow: 1;
				font-size: 28rpx;
				font-weight: 500;

				&:nth-child(1) {
					border-right: 1px solid #F2F2F2;
				}

				&:nth-child(2) {
					border-left: 1px solid #F2F2F2;
				}
			}

			.gray {
				color: #999999;
			}
		}
	}
</style>